<%@ page import="com.bdqn.pojo.Newtable" %>
<%@ page import="com.bdqn.dao.NewDao" %>
<%@ page import="com.bdqn.pojo.NewType" %>
<%@ page import="com.bdqn.dao.NewTypeDao" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: ASUS
  Date: 2023/8/22
  Time: 16:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>

  <title>Title</title>
  <style>
    table{
      border: 1px solid red;
      margin: 0px auto;
      border-collapse: collapse;
      width: 800px;
      font-size: 30px;
      text-align: center;
      color:blue;

    }
    td{
      border: 1px solid red;
    }
    .a
    {
      width: 200px;
      height: 40px;
      font-size: 30px;
    }

  </style>


    <script type="text/javascript" src="jquery-2.0.0.min.js"></script>
    <script>
        function  show(){
            //使用jquery 发起异步请求
            //Web1/ajax2?title=aaa

            var str=$("#nn").val();
            $.ajax({
                url:'/Web1/ajax2',
                type:'get',
                beforeSend:function ()
                {
                    $("#sho").show();
                },
                data:{title:str},
                success:function (data) {
                    $("#sho").hide();
                    if(data=="ok")
                    {
                        $("#ss").text("数据库已经存在");
                    }
                    else
                    {
                        $("#ss").text("数据库不存在");
                    }
                }
            })
        }
    </script>

</head>
<body>
<% List<NewType> list= NewTypeDao.getlist(); %>

<jsp:include page="Top.jsp"></jsp:include>
<form action="/Web1/NewADD" method="post">
  <table>
    <tr>
      <td>标题</td>
      <td>
          <input onmouseleave="show();" class="a" id="nn" name="nn" type="text">

          <span id="ss" style="color: red;"></span>
          <div id="sho" style="display: none;"><img src="1.gif"></div>
      </td>
    </tr>
    <tr>
      <td>新闻类型：</td>
      <td>
         <select name="s1" class="a" id="s1">
            <% for(NewType obj:list){ %>
                <option value="<%=obj.getId() %>"><%=obj.getName() %></option>
            <%}%>
         </select>
      </td>
    </tr>
      <tr>
          <td>新闻内容：</td>
          <td>
              <textarea id="newscontent" name="newscontent" class="ckeditor" ></textarea>

          </td>
      </tr>
    <tr>
      <td colspan="2">
        <input type="submit" value="添加">
      </td>
    </tr>
  </table>

</form>
<jsp:include page="Bom.jsp"></jsp:include>
</body>
</html>
